# pre
system("sudo tcpdump -i en0 -c 1000 -w /tmp/foo.pcap");
system("tcpdump -r /tmp/foo.pcap -n -q -t -g> /tmp/foo.out");

# IP 24.4.250.120.50944 > 192.168.1.67.58485: tcp 1448
print "digraph graphname {\n";
print "layout=circo;\n";
foreach $line (`cat /tmp/foo.out`) {
    if ($line =~ /([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)\.[0-9]+\s+\>\s+([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/) {
	print "\"$1\" -> \"$2\";\n";
    }
}
print "}\n";

# clean up
system("rm /tmp/foo.pcap");
system("rm /tmp/foo.out");
